# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=geoclue
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.12.99
#pkgver=2.2.0
pkgrel=3
arch=('any')
pkgdesc="Modular Geoinformation Service (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-libxml2"
         "${MINGW_PACKAGE_PREFIX}-libxslt"
         "${MINGW_PACKAGE_PREFIX}-dbus-glib")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-python2"
             "gtk-doc")
optdepends=("${MINGW_PACKAGE_PREFIX}-libsoup: Skyhook location provider")
options=('strip' 'staticlibs')
license=("BSD")
url="https://www.freedesktop.org/wiki/Software/GeoClue/"
source=(https://people.freedesktop.org/~hadess/${_realname}-${pkgver}.tar.gz
        #https://freedesktop.org/software/geoclue/releases/${pkgver:0:3}/${_realname}-${pkgver}.tar.xz
        geoclue-0.12.0-win32reloc.patch
        geoclue-0.12.99-ldflags.patch
        gio-win.patch
        )
sha256sums=('fe396c91cb52de4219281f4d9223156338fc03670d34700281e86d1399b80a72'
            '44ec6a25b0139dca8f3864928bf875f3641c87d01970b732dd9dc86f75f334a4'
            'faddfc54c3625a2cc68532bd3bd745c28d15d6987f98a49998d156255fda91db'
            '639baee194ad44e9f73214f336d1912065e26de76db6db477ce7882e6f3694f5')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/geoclue-0.12.0-win32reloc.patch
  patch -p1 -i ${srcdir}/geoclue-0.12.99-ldflags.patch
  autoreconf -f -i
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
